# -*-coding:utf-8 -*-
import requests
from lxml import etree
j=0
url_list=["https://www.meizitu.com/a/list_1_%d.html" %(i)for i in range(1,93)]
for url in url_list:
    response=requests.get(url)
    html=etree.HTML(response.content)
    li_list=html.xpath('//ul[@class="wp-list clearfix"]/li')
    a=html.xpath("//a/img/@src")
    for i in a:
        try:
            pic = requests.get(i, timeout=5)  # 超时异常判断 5秒超时
        except requests.exceptions.ConnectionError:
            print('当前图片无法下载')
            continue
        file_name="E:\Picture/" + str(j) + ".jpg"
        print(file_name)
        fp = open(file_name, 'wb')
        fp.write(pic.content)
        fp.close()
        j+=1

